home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Cafe 3
/
Visual Cafe 3.ISO
/
Vcafe
/
JFC.bin
/
MultiListUI.java
< prev
next >
Wrap
Text File
|
1998-06-30
|
4KB
|
133 lines
/*
* @(#)MultiListUI.java 1.12 98/02/02
*
* Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the confidential and proprietary information of Sun
* Microsystems, Inc. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Sun.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*
*/
package com.sun.java.swing.plaf.multi;
import java.util.Vector;
import java.io.Serializable;
import com.sun.java.swing.*;
import java.awt.*;
import com.sun.java.swing.plaf.*;
/**
* MultiListUI implementation
* <p>
* Warning: serialized objects of this class will not be compatible with
* future swing releases. The current serialization support is appropriate
* for short term storage or RMI between Swing1.0 applications. It will
* not be possible to load serialized Swing1.0 objects with future releases
* of Swing. The JDK1.2 release of Swing will be the compatibility
* baseline for the serialized form of Swing objects.
*
* @version 1.12 02/02/98
* @author Willie Walker
*/
public class MultiListUI extends ListUI
implements Serializable {
/**
* The Vector containing the real UI's. This is populated
* in the call to createUI, and can be obtained by calling
* getUIs. The first element is guaranteed to the real UI
* obtained from the default look and feel.
*/
protected Vector uis = new Vector();
////////////////////
// Common UI methods
////////////////////
public static ComponentUI createUI(JComponent c) {
ComponentUI mui = new MultiListUI();
return MultiLookAndFeel.createUIs(mui,
((MultiListUI) mui).uis,
c);
}
/**
* Return the list of UI's associated with this multiplexing UI. This
* allows processing of the UI's by an application aware of multiplexing
* UI's on components.
*/
public ComponentUI[] getUIs() {
return MultiLookAndFeel.uisToArray(uis);
}
//////////////////////
// ComponentUI methods
//////////////////////
public void installUI(JComponent c) {
for (int i = 0; i < uis.size(); i++) {
((ComponentUI) (uis.elementAt(i))).installUI(c);
}
}
public void uninstallUI(JComponent c) {
for (int i = 0; i < uis.size(); i++) {
((ComponentUI) (uis.elementAt(i))).uninstallUI(c);
}
}
public void paint(Graphics g, JComponent c) {
for (int i = 0; i < uis.size(); i++) {
((ComponentUI) (uis.elementAt(i))).paint(g,c);
}
}
public void update(Graphics g, JComponent c) {
for (int i = 0; i < uis.size(); i++) {
((ComponentUI) (uis.elementAt(i))).update(g,c);
}
}
public Dimension getPreferredSize(JComponent c) {
return ((ComponentUI) (uis.elementAt(0))).getPreferredSize(c);
}
public Dimension getMinimumSize(JComponent c) {
return ((ComponentUI) (uis.elementAt(0))).getMinimumSize(c);
}
public Dimension getMaximumSize(JComponent c) {
return ((ComponentUI) (uis.elementAt(0))).getMaximumSize(c);
}
public boolean contains(JComponent c, int x, int y) {
return ((ComponentUI) (uis.elementAt(0))).contains(c,x,y);
}
/////////////////
// ListUI Methods
/////////////////
public int locationToIndex(JList list, Point location) {
return ((ListUI) (uis.elementAt(0))).locationToIndex(list, location);
}
public Point indexToLocation(JList list, int index) {
return ((ListUI) (uis.elementAt(0))).indexToLocation(list, index);
}
public Rectangle getCellBounds(JList list, int index1, int index2) {
return ((ListUI) (uis.elementAt(0))).getCellBounds(list,index1,index2);
}
}